package com.struc.td;

/*
 * This is our towerspace class. It is the entitys that we can
 * build our towers on. And is very similar to the basics in
 * one of our tower classes
 */

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Rectangle;

public class TowerSpace extends Entity{
	private Texture entityMap;
	private Sprite towerSpace;
	private Sprite towerSelectspr;
	private Sprite infoBackground;
	private Sprite exitInfo; 
	private Sprite damageTower;
	private Sprite slowTower;

	public TowerSpace(int x, int y){
		exitInfo = new Sprite(StaticTextures.info_panel_exitInfo,0,0,64,27);
		infoBackground = new Sprite(StaticTextures.tower_space_infoBG);
		damageTower = new Sprite(StaticTextures.tower_space_towerMap,0,240,124,42);
		slowTower = new Sprite(StaticTextures.tower_space_towerMap,0,325,124,42);
		towerSelectspr = new Sprite(StaticTextures.tower_space_towerSelected, 0, 0, 128, 118);
		entityMap = StaticTextures.entity_map;
		towerSpace = new Sprite(entityMap, 270, 65, 128, 118);
		towerSpace.setPosition(x, y);
		towerSpace.setSize(towerSpace.getWidth()*0.7f,towerSpace.getHeight()*0.7f);
		towerSelectspr.setPosition(x, y);
		towerSelectspr.setSize(towerSpace.getWidth(),towerSpace.getHeight());
	}

	public Rectangle getBounds() {
		return towerSpace.getBoundingRectangle();
	}

	public void update(){
	}

	public void render(SpriteBatch sb){
		towerSpace.draw(sb);
	}
	public void renderSelected(SpriteBatch sb) {
		towerSelectspr.draw(sb);
	}

	public void renderInfo(SpriteBatch sb) {
		infoBackground.setBounds(Gdx.graphics.getWidth()-Gdx.graphics.getWidth()/3, 0, Gdx.graphics.getWidth()/3, Gdx.graphics.getHeight());
		exitInfo.setBounds(infoBackground.getX(), Gdx.graphics.getHeight()-Gdx.graphics.getHeight()/15, infoBackground.getWidth()/3, infoBackground.getHeight()/15);
		slowTower.setBounds(infoBackground.getX(), 142f/512f*Gdx.graphics.getHeight(),124f/256f*infoBackground.getWidth() ,42f/512f*Gdx.graphics.getHeight());
		damageTower.setBounds(infoBackground.getX(), 230f/512f*Gdx.graphics.getHeight(),124f/256f*infoBackground.getWidth() ,42f/512f*Gdx.graphics.getHeight());
		infoBackground.draw(sb,0.8f);
		exitInfo.draw(sb, 0.6f);
		damageTower.draw(sb);
		slowTower.draw(sb);
	}

	public Rectangle getInfoBounds() {
		return infoBackground.getBoundingRectangle();
	}
	public Rectangle getExitInfoRect() {
		return exitInfo.getBoundingRectangle();
	}
	public Rectangle getDamageTowerRect() {
		return damageTower.getBoundingRectangle();

	}
	public Rectangle getSlowTowerRect() {
		return slowTower.getBoundingRectangle();

	}
}
